#include<stdio.h>
#include<stdlib.h>

typedef struct LNode
{
    int data;
    struct LNode* next;
}LNode, * LinkedList;
LinkedList createList()
{
    LinkedList headNode = (LinkedList)malloc(sizeof(LNode));
    headNode->data = 0;
    headNode->next = NULL;
    return headNode;
}
LNode* createNode(int data)
{
    LNode* newNode = (LinkedList)malloc(sizeof(LNode*));
    newNode->data = data;
    newNode->next = NULL;
    return newNode;
}
LinkedList Merge(LinkedList L1, LinkedList L2)
{
    if (L1 == NULL && L2 == NULL)
    {
        return NULL;
    }
    LinkedList p1 = L1->next;
    LinkedList p2 = L2->next;
    LinkedList list = (LinkedList)malloc(sizeof(struct LNode));
    list->next = NULL;
    LinkedList p = list;
    while (p1 && p2)
    {
        if (p1->data < p2->data)
        {
            p->next = p1;
            p1 = p1->next;
        }
        else {
            p->next = p2;
            p2 = p2->next;
        }
        p = p->next;
    }
    if (p1)
        p->next = p1;
    if (p2)
        p->next = p2;
    L1->next = NULL;
    L2->next = NULL;
    return list;
}
int main()
{
    int a;
    scanf("%d", &a);
    LinkedList l1 = createList();
    LinkedList l2 = createList();
    LinkedList p1 = NULL;
    LinkedList p2 = NULL;
    p1 = l1;
    p2 = l2;
    int data;
    for (int i = 0; i < a; i++)
    {
        scanf("%d", &data);
        LinkedList p = createNode(data);
        p1->next = p;
        p1 = p;
    }
    for (int i = 0; i < a; i++)
    {
        scanf("%d", &data);
        LinkedList p = createNode(data);
        p2->next = p;
        p2 = p;
    }
    LinkedList l3 = Merge(l1, l2);
    for (int i = 0; i < a; i++)
    {
        l3 = l3->next;
    }
    int a1 = l3->data;
    l3 = l3->next;
    int a2 = l3->data;
    printf("%d\n", (a1 + a2) / 2);
    return 0;
}
